<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const p1 = new Promise((resolve, reject) => {
            console.log("请求一份完整的数据");
            try {
                setTimeout(() => {
                    console.log("数据请求状态");
                    throw new Error("网络错误");
                    resolve({
                        token: 成功啦
                    })

                })
            }catch(e){
                reject(e.message)
            }
            
        })

        const a = p1.then((value)=>{
            console.log("成功来了");
            
        })
        console.log("a",a);

        const b = p1.catch((reason)=>{
            console.log("失败来了");
        })
        console.log("b",b);

        const c = p1.finally(()=>{
            console.log("与我无关");
            throw new Error("暂且网络错误");
        })
        console.log("c",c);



    </script>
</body>

</html>